
pkgname=cryptsetup
pkgver=2.0.3
pkgrel=1
pkgdesc="Utility used to conveniently setup disk encryption based on DMCrypt kernel module."
arch=('x86_64')
license=('GPL')
url="https://gitlab.com/cryptsetup/cryptsetup/blob/master/README.md"
groups=('base')
depends=('device-mapper' 'libgcrypt' 'popt' 'util-linux' 'json-c' 'argon2')
options=('!libtool' '!emptydirs')
source=("https://www.kernel.org/pub/linux/utils/cryptsetup/v2.0/${pkgname}-${pkgver}.tar.xz"
        'encrypt_hook'
        'encrypt_install'
        'sd-encrypt')
sha256sums=('4d6cca04c1f5ff4a68d045d190efb2623087eda0274ded92f92a4b6911e501d4'
            '5cbc819a1c867fabcbc0721b078be96c1f22116bbdf11ae7da1e50a8f6590acb'
            '9f78cab3caf45dcd6534973472a9f6051ac0a6859369afb143f24a9c34a3073f'
            '01956fc738ee1d42ba9d962615fcd2c13ad2e8119b1ba38a002e15c631ee8daf')
build() {
  cd ${pkgname}-${pkgver}
  
  ./configure --prefix=/usr \
        --disable-static \
        --enable-cryptsetup-reencrypt \
        --enable-libargon2
  make
}

package() {
  cd ${pkgname}-${pkgver}
  make DESTDIR=${pkgdir} install

  install -D -m644 ${srcdir}/encrypt_hook ${pkgdir}/usr/lib/initcpio/hooks/encrypt
  install -D -m644 ${srcdir}/encrypt_install ${pkgdir}/usr/lib/initcpio/install/encrypt
  install -D -m644 ${srcdir}/sd-encrypt ${pkgdir}/usr/lib/initcpio/install/sd-encrypt
}

